package demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan("demo")
public class MainStat {

	public static void main(String[] args) {
		try {
			ApplicationContext context=new AnnotationConfigApplicationContext(MainStat.class);
			UserServiceImpl bean = context.getBean(UserServiceImpl.class);
			if(bean != null){
				bean.sayHiSpring();
			}else{
				System.out.println("无法获取UserServiceImpl bean");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
